<?php 
global $dir_tpl, $tb_fix, $temp, $anyDB, $temp;
$sql = "select t.tou_id, t.tou_title, t.tou_category, t.tour_cat_parent_id,t.tou_root_cat_id, t.tkh_id, t.tou_desc, t.tou_price, t.tou_begin_time, tm.tme_title
            from ".$tb_fix."_tour as t
                left join ".$tb_fix."_tour_menu as tm
                        on t.tou_category = tm.tme_id
            where tou_status = 1
            limit 0,3";
$q = $anyDB->query($sql);
if($anyDB->numRows($q)>0){
    $rows = $anyDB->getAll($q);
    foreach($rows as $k=>$v){
        $rows[$k]['tou_title_cut'] = subCutString($v['tou_title'],10);
        $rows[$k]['tou_desc'] = subCutString($v['tou_desc'],40);  
        $rows[$k]['tou_title_url'] = convertText($v['tou_title']);      
        $rows[$k]['tou_cat_url'] = convertText($v['tme_title']);
        if($v['tou_root_cat_id'] == 1){
            $rows[$k]['TourRootName'] = "tour-nuoc-ngoai";
        }else{
            $rows[$k]['TourRootName'] = "tour-trong-nuoc";
        }
        $tourid = $v['tou_id'];
        $sql = "select mti_url from ".$tb_fix."_tour_img where tou_id = $tourid order by RAND() limit 0,1";
        $q = $anyDB->query($sql);
        if($anyDB->numRows($q)>0){
            $rImg = $anyDB->getAll($q);
            foreach($rImg as $key=>$val){
                //$rows[$k]['images'] = $val['mti_url'];
                $rows[$k]['images'] = "_showpic/phpThumb.php?src=../".$val['mti_url']."&w=240&h=146";    
            }
            
        }else{
                $rows[$k]['images'] = "_showpic/phpThumb.php?src=../_temp/mctourist/images/noImage.jpg&w=240&h=146";
        }
    }    
}
$temp->assign("r",$rows);            
$temp->display("$dir_tpl/blocks/home_tour_hot/tpl_home_tour_hot.mct"); 
?> 
